<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>尚硅谷会员登录页面</title>
<link type="text/css" rel="stylesheet" href="../../static/css/style.css" >
	<script src="../../Script/jquery.js"></script>
	<script src="../../Script/axios.js"></script>
	<script type="text/javascript">
		$(function () {
			axios({
				method: "get",
				url: "http://localhost:8080/library/cookieServlet"
			}).then(function (resp) {
				var user = resp.data;
				$("#username").val(user.name)
				$("#password").val(user.password)
			})

			$("#sub_btn").click(function (){
				var formData = {
					name:$("#username").val(),
					password:$("#password").val()
				}
				axios({
					method:"post",
					url:"http://localhost:8080/library/loginServlet?remember="+$(":checkbox:checked").val(),
					data:formData
				}).then(function (resp){
					if(resp.data == "1"){
						location.href="login_success.html"
					} else {
						$(".errorMsg").text("用户名或密码错误")
					}
				})
			})

		})
	</script>
</head>
<body>
		<div id="login_header">
			<img class="logo_img" alt="" src="../../static/img/logo.png" >
			<span class="wel_word">图书管理系统</span>
		</div>
		
			<div class="login_banner">
			
				<div id="l_content">
					<span class="login_word">欢迎登录</span>
				</div>
				
				<div id="content">
					<div class="login_form">
						<div class="login_box">
							<div class="tit">
								<h1>会员登录</h1>
								<a href="regist.html">立即注册</a>
							</div>
							<div class="msg_cont">
								<b></b>
								<span class="errorMsg">请输入用户名和密码</span>
							</div>
							<div class="form">
								<form action="">
									<label>用户名称：</label>
									<input class="itxt" type="text" placeholder="请输入用户名" autocomplete="off" tabindex="1" name="username" id="username"/>
									<br />
									<br />
									<label>用户密码：</label>
									<input class="itxt" type="password" placeholder="请输入密码" autocomplete="off" tabindex="1" name="password" id="password"/>
									<br />
									<input type="checkbox" name="remember" value="1" id="remember"> 记住我
									<br />
									<br />
									<input type="button" value="登录" id="sub_btn" />
								</form>
							</div>
							
						</div>
					</div>
				</div>
			</div>
		<div id="bottom">
			<span>
				图书管理系统.suo &copy;2022
			</span>
		</div>
</body>
</html>